package com.fanhang.samples.spring.session.common;

import java.util.Set;

import org.springframework.session.ExpiringSession;
import org.springframework.session.MapSession;

/**
 * Created by Administrator on 2016/9/14.
 */
public class MemcachedSession implements ExpiringSession {
	private final MapSession cached;

	public MemcachedSession(MapSession cached) {
		this.cached = cached;
	}

	public String getId() {
		return cached.getId();
	}

	@Deprecated
	public Object getAttribute(String attributeName) {
		return cached.getAttribute(attributeName);
	}

	public Set<String> getAttributeNames() {
		return cached.getAttributeNames();
	}

	public void setAttribute(String attributeName, Object attributeValue) {
		this.cached.setAttribute(attributeName, attributeValue);
	}

	public void removeAttribute(String attributeName) {
		this.cached.removeAttribute(attributeName);
	}

	@Override
	public long getCreationTime() {
		return cached.getCreationTime();
	}

	@Override
	public long getLastAccessedTime() {
		return cached.getLastAccessedTime();
	}

	@Override
	public void setMaxInactiveIntervalInSeconds(int interval) {
		cached.setMaxInactiveIntervalInSeconds(interval);
	}

	@Override
	public int getMaxInactiveIntervalInSeconds() {
		return cached.getMaxInactiveIntervalInSeconds();
	}

	@Override
	public boolean isExpired() {
		// TODO Auto-generated method stub
		return false;
	}
}
